export function formatCount(value: number): number | string {
  if (value >= 10000) {
    return Math.floor(value / 10000) + '万'
  } else if (value >= 100000000) {
    return Math.floor(value / 100000000) + '亿'
  } else {
    return value
  }
}

export function getImageSize(
  picUrl: string,
  width: number,
  height: number
): string {
  return picUrl + `?param=${width}x${height}`
}

export function getSongUrl(id: number) {
  return `https://music.163.com/song/media/outer/url?id=${id}.mp3`
}

export function formatTime(time: number): string {
  if (time) {
    const temp = time | 0
    const minute = ((temp / 60) | 0).toString().padStart(2, '0')
    const second = (temp % 60).toString().padStart(2, '0')
    return `${minute}:${second}`
  } else {
    return '00:00'
  }
}

export function formatSingerName(ar: any[]): string {
  if (!ar) return ''
  return ar
    .map((item, index) => {
      if (index === ar.length - 1) return item.name
      return item.name + '/'
    })
    .join('')
}
